package com.insuremonitor.system.service.impl;

import com.insuremonitor.common.core.domain.R;
import com.insuremonitor.common.utils.oss.AliyunOssUploadUtils;
import com.insuremonitor.system.service.IFileService;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

@Service
public class FileServiceImpl implements IFileService {

    @Override
    public R upload(MultipartFile file) {

        try {
            String url = AliyunOssUploadUtils.uploadFile(file);

            return R.ok(url);
        }catch (Exception e){

            e.printStackTrace();
            return R.fail("上传失败");

        }
    }
}
